package nccloud.rongq.bill.rongqvo.action;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

import nc.vo.pub.BusinessException;
import nccloud.framework.core.exception.ExceptionUtils;
import nccloud.framework.service.ServiceLocator;
import nccloud.framework.web.action.itf.ICommonAction;
import nccloud.framework.web.container.IRequest;
import nccloud.itf.rongq.bill.IRongqvoMaintain;

public class SendAction implements ICommonAction {

	@Override
	public Object doAction(IRequest request) {
		
		String content = request.read();
		
		JSONObject root = JSONObject.parseObject(content);
		JSONArray pks = root.getJSONArray("pks");
		
		String[] ids = new String[pks.size()];
		for(int i = 0; i < ids.length; i ++) {
			ids[i] = pks.getString(i);
		}
		
		IRongqvoMaintain find = ServiceLocator.find(IRongqvoMaintain.class);
		try {
			find.sendMsgs(ids);
		} catch (BusinessException e) {
			e.printStackTrace();
			ExceptionUtils.wrapBusinessException(e.getMessage());
		}
		
		
		return null;
	}

}
